package com.zb.spring5.configuration;

import com.zb.spring5.ioc.entity.Singer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

public class SingerConfig {

    @Configuration
    public static class SingerConfigDemo{
        @Lazy
        @Bean(initMethod = "init")
        Singer singerOne(){
            Singer singer = new Singer();
            singer.setName("八戒");
            singer.setAge(39);
            return  singer;
        }
        @Lazy
        @Bean(initMethod = "init")
        Singer singerTwo(){
            Singer singer = new Singer();
            singer.setAge(56);
            return  singer;
        }
        @Lazy
        @Bean(initMethod = "init")
        Singer singerThree(){
            Singer singer = new Singer();
            singer.setName("孙悟空");
            return  singer;
        }
    }
}
